home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- /*
- | Description:
- | Defines the NurbMaker class. Given a quadMesh,
- | a bunch of parameters, it creates a group node with a bunch
- | of SoIndexedNurbsSurface nodes. These nodes will create a nurbs
- | surface if placed after an SoCoordinate3 node with the number of
- | points specified by the QuadMesh node.
- |
- | Note that you only need to look at the SoCoordinate3 node if
- | you need to figure out whether edges match for wraparound.
- | Otherwise this is all strictly 'topological'
- |
- | Author(s) : Paul Isaacs
- |
- */
-
- #ifndef _NURB_MAKER
- #define _NURB_MAKER
-
- #include <Inventor/SbLinear.h>
-
- extern class SoGroup;
- extern class SoCoordinate3;
- extern class SoQuadMesh;
- extern class SoIndexedNurbsSurface;
-
- ////////////////////////////////////////////////////////////////////
- // Class: NurbMaker
- //
- ////////////////////////////////////////////////////////////////////
-
- // C-api: prefix=NrbMkr
- class NurbMaker {
-
- public:
- // Constructor, destructor
- NurbMaker();
- ~NurbMaker();
-
- // You can save me some work if you tell me whether the edges line up.
- // If you're not wrapping it won't matter, but if you wrap it will.
- SoGroup *createNurbsGroup(SbVec2s numQuadMeshDivisions,
- SbVec2s doEdgesMatch );
- SoGroup *createNurbsGroup(SoQuadMesh *quadNode,
- SoCoordinate3 *coordNode = NULL);
-
- // Default is FALSE
- void setFlipNormals(SbBool newFlip) {flipNormals = newFlip; };
- SbBool isFlipNormals() { return flipNormals; };
-
- enum PatchType {
- BEZIER,
- CUBIC,
- CUBIC_TO_EDGE,
- USER_KNOTS
- };
- // Default is CUBIC_TO_EDGE
- void setPatchType(PatchType newPatchType);
- PatchType getPatchType() { return patchType; }
-
- // Default is FALSE.
- void setWraparound( SbVec2s newWrap )
- { myWrap = newWrap; }
- const SbVec2s &getWraparound() { return myWrap; }
-
- // Default is 1, for CUBIC
- // This tells how many rows/columns to move over when we go to make
- // the next sub-patch. Setting patchType to CUBIC changes it to 1,
- // and BEZIER to 3.
- void setPatchShift( SbVec2s newShift )
- { myShift = newShift; }
- const SbVec2s &getPatchShift()
- { return myShift; }
-
-
- // Default is not to use the user knots, but standard ones for
- // BEZIER, CUBIC, or CUBIC_TO_EDGE
- void setUserKnots( SbVec2s newNumKnots,
- float *newUKnots = NULL, float *newVKnots = NULL);
- void getUserKnots( SbVec2s &numKnots, float *UKnots, float *VKnots);
- void setUserCurveOrder( SbVec2s newOrder ) { userOrder = newOrder; }
- const SbVec2s &getUserCurveOrder() { return userOrder; }
-
- protected:
-
- void establishMyKnotParams();
- void applyCubicToEdgeKnotVectors(int row, int col,
- SoIndexedNurbsSurface *myNurb, int lastRowToDo, int lastColToDo);
- private:
- SoGroup *nurbsGroup;
-
- PatchType patchType;
- SbBool flipNormals;
-
- SbVec2s userNumKnots;
- float *userUKnots, *userVKnots;
- SbVec2s userOrder;
-
- SbVec2s myNumKnots;
- SbVec2s myOrder;
- SbVec2s myShift;
- SbVec2s myWrap;
- float *myUKnots, *myVKnots;
- };
-
- #endif /* _NURB_MAKER */
-